ActiveReports Developer 7
Sort Data
See Also Support Forum
ActiveReports Developer 7 > ActiveReports Developer Guide > How To > Page Report How To > Sort Data

Glossary Item Box

In a page report, you can apply sorting on a data region, grouped data or fixed page.

Use the following steps to determine how to sort your data. These steps assume that you have already added a Page Report (xml-based) template to your project and connected it to a data source. See Adding an ActiveReport to a Project, Connect to a Data Source and Add a Dataset for more information.

ShowSorting in a Data Region

You can set the sorting expression on the Sorting page of a data region dialog.

  1. Right-click the data region and select Properties to open the Properties window. Select the Property dialog link under properties where the commands are displayed to open the data region dialog. See Properties Window for more information.
  2. In the dialog that appears, go to the Sorting page and click the Add(+) icon to add an empty expression to the sorting list below.
  3. In the Expression field, enter the expression directly or use <Expression...> from the dropdown to open the Expression Editor and select the field on which you want to sort your data.
  4. Under Direction, select Ascending or Descending to set the order in which to sort your data.
  5. Click OK to close the dialog.
  6. From the Report Explorer, drag and drop the field on which the sorting expression is set and go to the Preview Tab to view the result.

The following image shows the result after setting sorting in a Table data region on the Title field in Ascending order:


ShowSorting on Grouped Data

You can sort the order of groups through the Sorting tab of the Groups page or the Detail Grouping page of the List data region. The following steps assume that you have already grouped data in the data region. See Grouping in a Data Region for further information on grouping.

Note: In a Chart data region dialog, the Sorting tab is available on the Category Groups and Series Groups pages.
  1. On the Groups or the Detail Grouping page of the data region dialog, select the Sorting tab.
  2. In the Sorting tab, click the Add(+) icon to add an empty expression to the sorting list.
  3. In the Expression field, enter the expression directly or use <Expression...> from the dropdown to open the Expression Editor and select the field on which you want to sort your data. The expression set here should be the same as the grouping expression.
  4. Under Direction, select Ascending or Descending to set the order in which to sort your data.
  5. Click OK to close the dialog.
  6. From the Report Explorer, drag and drop the field on which sorting is set and go to the Preview Tab to view the result.

The following image shows the result on a Table data region where grouping and sorting is set on the StorePrice field in Descending order:


ShowSorting on a Fixed Page

In a fixed page layout (FPL), if the fixed page is grouped on a dynamic value, you can sort the order of the groups through the Sorting page of the FixedPage Dialog. Follow the steps below to learn setting up sorting on a Fixed Page:

  1. Right-click the gray area of the report and select Fixed Layout Settings to open the FixedPage dialog.
    OR
    Right click the report page and select Properties to open the Properties window. Select the Property dialog link under properties where the commands are displayed to open the FixedPage dialog. See Properties Window for more information on commands.
  2. In the FixedPage dialog that appears, go to the Grouping page and in the Expression field, enter the expression directly or use <Expression...> from the dropdown to open the Expression Editor and select the field on which you want to group your data.
  3. In the FixedPage dialog, now go to the Sorting page and click the Add(+) icon to add an empty expression to the sorting list below and in the Expression field enter the same expression you used for grouping the data.
  4. Under Direction, select Ascending or Descending to set the order in which to sort your data.
  5. Click OK to close and apply the settings.
  6. From the Report Explorer, drag and drop the field on which sorting is set and go to the Preview Tab to view the result.
Note: The difference in setting sorting on a Fixed Page is that it affects every data region placed on the report layout, whereas sorting on a data region is limited to the data region only.

The following images shows the result when sorting is set on a fixed page on the StorePrice field in descending order:

Page 1 Page 2

See Also

Concepts
Sorting

©2014. ComponentOne, a division of GrapeCity. All rights reserved.